import request from './request'

export const getTalentCompanyAndJob = (params) => {
  return request({
    url: '/talentchain/api/companyJob/findTalentCompanyAndJob',
    method: 'POST',
    data: params,
  })
}

export const getPersonList = (params) => {
  return request({
    url: '/talentchain/api/vita/searchPage',
    method: 'POST',
    data: params,
  })
}

export function getTalentchainHome() {
  return request({
    url: '/talentchain/api/config/getWorkCategoryTree',
    method: 'GET',
  })
}

export const getJobDetail = (id) => {
  return request({
    url: `/talentchain/api/companyJob/viewJobDetail/${id}`,
    method: 'GET',
  })
}

//查询相似岗位
export function findSimilarJob(params) {
  return request({
    url: `/talentchain/api/companyJob/findSimilarJob`,
    method: 'POST',
    data: params,
  })
}

//查询简历
export function getVitaDetail(id) {
  return request({
    url: `/talentchain/api/vita/view?id=${id}`,
    method: 'GET',
  })
}

// 查看简历联系方式
export const getVitaPhone = (id) =>
  request({
    url: `/talentchain/vita/viewContact/${id}`,
    method: 'GET',
  })

// 查看公司详情
export const getCompany = (id) =>
  request({
    url: `/talentchain/api/companyJob/findTalentCompanyHome/${id}`,
    method: 'GET',
  })

// 查看公司联系方式
export const getCompanyPhone = (id) =>
  request({
    url: `/member/company/viewContact/${id}`,
    method: 'GET',
  })

// 收藏职位
export const jobCollectOperate = (id) =>
  request({
    url: `/talentchain/companyJob/favorite/${id}`,
    method: 'PUT',
  })

// 获取简历列表
export const getVitaList = (params) =>
  request({
    url: '/talentchain/vita/search',
    method: 'POST',
    data: params,
  })

// 职位是否已投递
export function hasSentJob(id) {
  return request({
    url: `/talentchain/companyJob/hasSentJob/${id}`,
    method: 'GET',
  })
}

// 投递简历到职位
export function jobSendResume(params) {
  return request({
    url: `/talentchain/companyJob/handResume`,
    method: 'POST',
    data: params,
  })
}

export const personCollectOperate = (id) =>
  request({
    url: `/talentchain/vita/favorite/${id}`,
    method: 'PUT',
  })

// 获取职位列表
export const getJobList = (params) =>
  request({
    url: '/talentchain/api/companyJob/searchPage',
    method: 'POST',
    data: params,
  })

// 保存邀请面试
export function saveInterview(params) {
  return request({
    url: '/talentchain/interview/save',
    method: 'POST',
    data: params,
  })
}
